package com.heima.article.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.article.mapper.ApArticleConfigMapper;
import com.heima.article.service.ApArticleConfigService;
import com.heima.model.article.pojos.ApArticleConfig;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author rookie001
 * @creat 2023-06-16-21:55
 */
@Service
public class ApArticleConfigServiceImpl extends ServiceImpl<ApArticleConfigMapper, ApArticleConfig> implements ApArticleConfigService {
    //更新上下级架
    @Override
    public void updatemap(Map map) {
        //ap_article中 isdown 1 为下架  wm_news中enable 1为上架
        boolean isdown = true;
        short enable = (short) map.get("enable");
        if (enable == 1) {
            isdown = false;
        }
        update(Wrappers.<ApArticleConfig>lambdaUpdate().set(ApArticleConfig::getIsDown, isdown).set(ApArticleConfig::getArticleId, map.get("articleId")));
    }
}
